--- layout: documentation title: Malloy Documentation footer: /generated/footers/visualizations/shape_maps.html ---

Shape Maps

The plugin currently supports US maps and state names. The model and data styles for the subsequent examples are:

export define airports is (explore 'malloy-data.faa.airports'
  primary key code
  airport_count is count(*)
  by_state is (reduce
    state
    airport_count
  )
);

Data Styles

{
  "by_state": {
    "renderer": "shape_map"
  }
}

Run as a simple query

explore airports
| by_state
1,0001,2001,4001,6001,800airport_count

Running a named query

explore airports
| reduce
  by_state
by_​state
5001,0001,500airport_count

Run as a trellis

By calling the configured map as a nested subtable, a trellis is formed.

explore airports
| reduce
  faa_region
  airport_count,
  by_state
faa_​region airport_​count by_​state
AGL 4,437 200400600800airport_count
ASW 3,268 5001,0001,500airport_count
ASO 2,924 200400600800airport_count
AEA 2,586 200400600800airport_count
ANM 2,102 200300400airport_count

Run as a trellis, repeated with different filters

explore airports
| reduce
  faa_region
  airport_count,
  by_state
  heliports is by_state : [fac_type :'HELIPORT']
  seaplane_bases is by_state : [fac_type :'SEAPLANE BASE']
faa_​region airport_​count by_​state heliports seaplane_​bases
AGL 4,437 200400600800airport_count 50100150200airport_count 204060airport_count
ASW 3,268 5001,0001,500airport_count 100200300400airport_count 51015airport_count
ASO 2,924 200400600800airport_count 50100150200250airport_count 10203040airport_count
AEA 2,586 200400600800airport_count 100200300airport_count 5101520airport_count
ANM 2,102 200300400airport_count 50100150airport_count 51015airport_count